import subprocess


def start():
    subprocess.call([
        'gunicorn',
        '-w', '3',  # 设置工作的进程数为3
        '--threads', '3',  # 设置每个进程的线程数为3
        '-k', 'uvicorn.workers.UvicornWorker',  # 进程类型
        '-b', '0.0.0.0:1482',  # ip和端口
        'apps.main:app'  # 入口文件
    ])


if __name__ == '__main__':
    start()

# 这个文件启动就行了，不用nohup
# python3 manage_YiFengApi_gunicorn1482.py
# nohup python3 manage_YiFengApi_gunicorn1482.py > ~/log_service/1480_out.log 2> ~/log_service/1480_err.log &
# nohup python3 manage_YiFengApi_gunicorn1482.py >/dev/null 2>&1 &    #不输出日志
# 最新10.0.0.1   2024Canon@Python
# nohup gunicorn -w 9 --threads 9 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:1481 apps.main:app >/dev/null 2>&1 &
# gunicorn -b 0.0.0.0:1484 -w 9 --worker-class gevent -k uvicorn.workers.UvicornWorker apps.main:app
# nohup gunicorn -b 0.0.0.0:1482 -w 9 --worker-class gevent -k uvicorn.workers.UvicornWorker apps.main:app >/dev/null 2>&1 &
# nohup gunicorn -b 0.0.0.0:1484 -w 9 --worker-class gevent -k uvicorn.workers.UvicornWorker --worker-connections 1000 apps.main:app >/dev/null 2>&1 &
